import Router from "koa-router";

import user from '@/controller/user'

import file from '@/controller/file'

import test from '@/controller/test'

import mysqlControl from '@/controller/mysql'

const indexRouter = new Router();

import {PERFIX_URL} from "@/config/router"

import KoaGraphql from 'koa-graphql'

import userGraphql from '@/graphql/user'

indexRouter.prefix(PERFIX_URL)

indexRouter.all('/usergraphql', KoaGraphql({
  schema: userGraphql,
  graphiql: true
}))

indexRouter.get("/", async (ctx) => {
  ctx.body = `hello Koa!`;
});

export {
  indexRouter,
  user,
  file,
  test,
  mysqlControl
};
